#ifndef __TRANSACTION_H__
#define __TRANSACTION_H__

#include "membackend/accurateAddressMappingConfig.h"
#include "membackend/accurateTransaction.h"

typedef enum TransactionType
{
    READ = 0,
    WRITE,
    BANK_STATE_SIZE
} TRANSACTION_TYPE;

class Transaction
{
private:
    uint64_t id;
    uint64_t address;
    TRANSACTION_TYPE type;
    uint64_t bank_id;
    uint64_t rank_id;
    uint64_t bank_group_id;
    uint64_t row_id;
    uint64_t column_id;
    // uint64_t line_id; // Added for cache line tracking

    uint64_t start_time;
    uint64_t end_time;
    uint64_t latency;


public:
    Transaction();

    Transaction(uint64_t id, uint64_t address, TRANSACTION_TYPE type, const AddressMappingConfig *amp);

    uint64_t getId() const { return id; }
    uint64_t getAddress() const { return address; }
    TRANSACTION_TYPE getType() const { return type; }
    void setType(TRANSACTION_TYPE newType) { type = newType; }
    void setId(uint64_t newId) { id = newId; }
    void setAddress(uint64_t newAddress) { address = newAddress; }

    uint64_t getBankId() const { return bank_id; }
    uint64_t getRankId() const { return rank_id; }
    uint64_t getBankGroupId() const { return bank_group_id; }
    uint64_t getRowId() const { return row_id; }
    uint64_t getColumnId() const { return column_id; }
    // uint64_t getLineId() const { return line_id; } // Added for cache line tracking

    void setBankId(uint64_t newBankId) { bank_id = newBankId; }
    void setRankId(uint64_t newRankId) { rank_id = newRankId; }
    void setBankGroupId(uint64_t newBankGroupId) { bank_group_id = newBankGroupId; }
    void setRowId(uint64_t newRowId) { row_id = newRowId; }
    void setColumnId(uint64_t newColumnId) { column_id = newColumnId; }
    // void setLineId(uint64_t newLineId) { line_id = newLineId; } // Added for cache line tracking
    
    uint64_t getStartTime() const { return start_time; }
    void setStartTime(uint64_t time) { start_time = time; }
    uint64_t getEndTime() const { return end_time; }
    void setEndTime(uint64_t time) { end_time = time; }
    uint64_t getLatency() const { return latency; }
    void setLatency(uint64_t lat) { latency = lat; }
};


#endif